package com.jk.api.controller;

import com.jk.common.annotation.KrtIgnoreAuth;
import com.jk.common.bean.ReturnBean;
import com.jk.kq.entity.Position;
import com.jk.kq.service.IPositionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 职位相关的微信小程序API接口
 *
 * @author 何任鹏
 * @version 1.0
 * @date 2020年06月02日
 */
@RestController
@RequestMapping("api/wechat/kq")
public class PositionApi {

    @Autowired
    private IPositionService positionService;

    /**
     * 根据id查找职位信息
     *
     * @param id
     * @return
     */
    @KrtIgnoreAuth
    @GetMapping("position")
    public ReturnBean position(Integer id) {
        Position position = positionService.selectById(id);
        return ReturnBean.ok(position);
    }


    /**
     * 查找所有的职位信息
     *
     * @return
     */
    @KrtIgnoreAuth
    @GetMapping("position/list")
    public ReturnBean list() {
        List<Position> positions = positionService.selectList();
        return ReturnBean.ok(positions);
    }

}
